@model HDLogCenter.Infrastructure.Models.LogDto
@{
    Layout = null;
    ViewData["Title"] = "日志详情";
}

<div class="layui-card">
    <div class="layui-card-header">
        <h2>日志详情</h2>
    </div>
    <div class="layui-card-body">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md6">
                <div class="layui-card">
                    <div class="layui-card-header">基本信息</div>
                    <div class="layui-card-body">
                        <table class="layui-table" lay-skin="nob">
                            <tr>
                                <td width="120">日志ID:</td>
                                <td>@Model.Id</td>
                            </tr>
                            <tr>
                                <td>服务器代码:</td>
                                <td>@Model.ServerCode</td>
                            </tr>
                            <tr>
                                <td>项目代码:</td>
                                <td>@Model.Code</td>
                            </tr>
                            <tr>
                                <td>服务器IP:</td>
                                <td>@Model.ServerIP</td>
                            </tr>
                            <tr>
                                <td>日志级别:</td>
                                <td>
                                    @if (Model.Level >= 4)
                                    {
                                        <span class="layui-badge layui-bg-red">Error (@Model.Level)</span>
                                    }
                                    else if (Model.Level >= 3)
                                    {
                                        <span class="layui-badge layui-bg-orange">Warning (@Model.Level)</span>
                                    }
                                    else if (Model.Level >= 2)
                                    {
                                        <span class="layui-badge layui-bg-blue">Information (@Model.Level)</span>
                                    }
                                    else
                                    {
                                        <span class="layui-badge layui-bg-gray">Debug (@Model.Level)</span>
                                    }
                                </td>
                            </tr>
                            <tr>
                                <td>创建时间:</td>
                                <td>@Model.CreateTime.ToString("yyyy-MM-dd HH:mm:ss")</td>
                            </tr>
                        </table>
                    </div>
                </div>
            </div>
            
            <div class="layui-col-md6">
                <div class="layui-card">
                    <div class="layui-card-header">请求信息</div>
                    <div class="layui-card-body">
                        <table class="layui-table" lay-skin="nob">
                            <tr>
                                <td width="120">HTTP方法:</td>
                                <td>@Model.HttpMethod</td>
                            </tr>
                            <tr>
                                <td>URL:</td>
                                <td>@Model.URL</td>
                            </tr>
                            <tr>
                                <td>响应时间:</td>
                                <td>@Model.Millisecond ms</td>
                            </tr>
                            <tr>
                                <td>是否超时:</td>
                                <td>
                                    @if (Model.IsTimeout)
                                    {
                                        <span class="layui-badge layui-bg-red">是</span>
                                    }
                                    else
                                    {
                                        <span class="layui-badge layui-bg-green">否</span>
                                    }
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
            </div>
        </div>
        
        <div class="layui-card" style="margin-top: 15px;">
            <div class="layui-card-header">消息内容</div>
            <div class="layui-card-body">
                <pre style="background: #f8f8f8; padding: 15px; border-radius: 4px; white-space: pre-wrap; word-wrap: break-word;">@Model.Message</pre>
            </div>
        </div>
        
        @if (!string.IsNullOrEmpty(Model.ErrorStack))
        {
            <div class="layui-card" style="margin-top: 15px;">
                <div class="layui-card-header">错误堆栈</div>
                <div class="layui-card-body">
                    <pre style="background: #f8f8f8; padding: 15px; border-radius: 4px; white-space: pre-wrap; word-wrap: break-word; color: #d32f2f;">@Model.ErrorStack</pre>
                </div>
            </div>
        }
    </div>
</div>